<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>视觉视口</title>
    <style>
        p{
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div id="result">
        
    </div>
    <p>我是一个测试哦</p>

    <script>
        //获取布局视口的宽度
        // console.log('布局视口的宽度' + document.documentElement.clientWidth);
        //获取 result 元素
        let result = document.querySelector('#result');
        //设置文本
        result.innerHTML = 'IOS 视觉视口宽度' + window.innerWidth ;
        result.innerHTML += '<br/>Android 视觉视口宽度' + window.visualViewport.width;


    </script>
</body>
</html>